package com.qf.controller;

import com.qf.common.vo.AddressVo;
import com.qf.common.vo.ResponseResult;
import com.qf.config.ShiroUtil;
import com.qf.service.AddressService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author KING
 * @ClassName: com.qf.controller.Address
 * @Description: 该类的功能描述
 * @date: 2021/10/27 11:22
 */
@RestController
@RequestMapping("/member/address")
public class AddressController {
    @Resource
    private AddressService addressService;

    /**
     * 查找当前用户的所有收货地址信息
     *
     * @return
     */
    @PostMapping("/find")
    public ResponseResult<List<AddressVo>> findAddress() {
        Long memberId = ShiroUtil.getMemberVoInfo().getUid();
        List<AddressVo> addressList = addressService.findAddress(memberId);
        return ResponseResult.success(addressList);
    }
}
